﻿using UnityEngine;
using System.Collections;

namespace View
{
    public class SmokeSystem
    {

        private const int MAX_PARTICLES = 37;

        private Texture2D texture;

        private SmokeParticle[] particles;

        public SmokeSystem(Vector2 startPos, float ratio)
        {
            texture = Resources.Load<Texture2D>("Textures/SmokeParticle");

            particles = new SmokeParticle[MAX_PARTICLES];

            for (int i = 0; i < particles.Length; i++)
            {
                particles[i] = new SmokeParticle(i, startPos, ratio);
            }
        }

        /// <summary>
        /// Call on this in MasterController.Update() to run view logic.
        /// </summary>
        public void Update()
        {
            for (int i = 0; i < particles.Length; i++)
            {
                particles[i].Update();
            }
        }

        /// <summary>
        /// Call on this in MasterController.OnGUI() to run view logic.
        /// </summary>
        public void OnGUI(GameCamera cam)
        {
            for (int i = 0; i < particles.Length; i++)
            {
                particles[i].OnGUI(texture, cam);
            }
        }
    }
}